home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: Is it possible to #include <#defined or -D 'ed macro>?
- Date: 26 Jan 1996 03:26:44 GMT
- Organization: Los Alamos National Laboratory
- Distribution: world
- Message-ID: <TANMOY.96Jan25202644@qcd.lanl.gov>
- References: <5rbuntgqp0.fsf@ritz.mordor.com> <4e8ap3$901@info1.sdrc.com>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: larry.jones@sdrc.com's message of 25 Jan 1996 16:22:59 GMT
-
- --text follows this line--
- In article <4e8ap3$901@info1.sdrc.com> larry.jones@sdrc.com (Larry
- Jones) writes:
- <snip>
- #include SOURCE
-
- cc -D SOURCE='<source_a.h>'
- cc -D SOURCE='<source_b.h>'
-
- should work on any ANSI conforming compiler.
-
- Almost. How the token sequence between < and > is interpreted as a
- header name pp-token is implementation defined. Notice that using a
- macro in an include line results in a token sequence, and not <
- h-char-sequence > which can be converted to a header-name q-char
- sequence without implementation dependence.
-
- I agree however that an implementation should do the obvious.
-
- (And of course, ANSI says nothing about compiler switches :-)
-
- By the way, if you have read my other post and wondering what in the
- standard confused me about the stringized version, the problem is that
- the standard says that after expansion the line is supposed to look
- like #include followed by a ", a q-char-sequence and another ", the
- last three therefore forming a header name. Of course, this can never
- happen since after expansion, what you get is #include followed by a
- string literal: and a string literal is not a header name (for
- example, one can't use \ portably within a header name, but one can
- inside a string literal). This is probably a mistake in the standard
- as is clear from a footnote.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-